package light.head.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Formula;

/**
 * 奖惩管理
 *
 */
@Entity
@Table
public class Reward implements Serializable {
	
	
	private static final long serialVersionUID = -3318051137695814673L;
	
	
	private Integer code;
	private Integer uc;						// 奖惩员工编号
	private String reason;					// 原因
	private Byte rtype;						// 类型(1、奖励 2、惩罚)
	private Integer cu;						//创建人
	private Date ct;						//创建时间
	private Boolean deleted = false;		//是否删除
	private String content;					//奖励内容
	private Integer oc;						// 所属机构
	
	//@Formula
	private String cun;						//创建人
	private String un;					//奖励员工姓名
	
	
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column(length = 200)
	public String getReason() {
		return reason;
	}
	@Column
	public Byte getRtype() {
		return rtype;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable = false, nullable = false)
	public Date getCt() {
		return ct;
	}
	@Column
	public String getContent() {
		return content;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cu)")
	public String getCun() {
		return cun;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Column
	public Integer getUc() {
		return uc;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = uc)")
	public String getUn() {
		return un;
	}
	
	
	
	
	
	
	
	
	
	public void setUc(Integer uc) {
		this.uc = uc;
	}
	public void setUn(String un) {
		this.un = un;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setCun(String cun) {
		this.cun = cun;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setReason(String reason) {
		this.reason = reason;
	}
	public void setRtype(Byte rtype) {
		this.rtype = rtype;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setContent(String content) {
		this.content = content;
	}
	

}
